package com.olympia.myapp.util;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;

import com.olympia.myapp.R;

public class MessageUtil {

	/**
	 * Truong hop hien thi Dialog ma khi nhan button se tra ve ket qua su lý
	 * 
	 * @param context
	 * @param resourceId
	 * @param nameCinemas
	 * @param context
	 * @param isShowOk
	 * @param isShowCancel
	 * @param process
	 */
	//private DialogMessage myMessage = null;

	public void showMyMessage(Context context, int resourceId, String title,
			String content, boolean isShowOk, boolean isShowCancel
			/*ProcessDialogMessage process*/) {
//		if (myMessage == null) {
//			myMessage = new DialogMessage(context, title, content, isShowOk,
//					isShowCancel, process);
//			myMessage.setIconTitle(resourceId);
//		} else {
//			myMessage.setInfo(title, content, isShowOk, isShowCancel);
//			myMessage.setIconTitle(resourceId);
//		}
//		myMessage.show();
	}

	/**
	 * hiển thị Dialog ma khi nhan se khong tra ve ket qua ma chi tat Dialog
	 * do di
	 * 
	 * @param context
	 * @param resourceId
	 * @param nameCinemas
	 * @param context
	 * @param isShowOk
	 * @param isShowCancel
	 */
	//private DialogMessage myAlert = null;

	public void showMyAlert(Context context, int resourceId, String title,
			String content, boolean isShowOk, boolean isShowCancel) {
		// if (myAlert == null) {
		// myAlert = new DialogMessage(context, title, content, isShowOk,
		// isShowCancel);
		// myAlert.setIconTitle(resourceId);
		// } else {
		// myAlert.setInfo(title, content, isShowOk, isShowCancel);
		// myAlert.setIconTitle(resourceId);
		// }
		// myAlert.show();
	}
	
	/**
	 * Hien thi dang toast
	 * 
	 * @param context
	 * @param info
	 */
	public void showToast(Context context, String info){
		TextView textView = new TextView(context);
		textView.setBackgroundResource(R.drawable.btn_dg);
		textView.setTextColor(Color.WHITE);
		textView.setPadding(20,10,20,10);
		textView.setText(info);
		
		Toast toastView = new Toast(context);
		toastView.setView(textView);
		toastView.setDuration(Toast.LENGTH_LONG);
		toastView.setGravity(Gravity.CENTER, 0,0);
		toastView.show();
	}
}
